<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>HTML5本地存储之Web Storage篇</title>
</head>
<body>
    <!--界面输入控件-->
    <div style="border: 2px dashed #ccc;width:320px;text-align: center">
        <label for="sitename">网站名：</label>
        <input type="text" id="sitename" name="sitename" class="text"/>
        <br/>
        <label for="siteurl">网址：</label>
        <input type="text" id="siteurl" name="siteurl"/>
        <br/>
        <input type="button" onclick="onSave()" value="新增记录"/>
        <input type="button" onclick="getclear()" value="清除记录">
        <p id="result"><br/></p>
        <hr/>
        <label for="search_site">输入网站名：</label>
        <input type="text" id="search_site" name="search_site"/>
        <input type="button" onclick="onFind()" value="查找网站"/>
        <p id="find_result"><br/></p>
        <hr/>
        <input type="button" onclick="startWorker()" value="开始计时"/>
        <input type="button" onclick="stopWorker()" value="停止计时"/>

    </div>

    <br/>


    <!--界面输出控件&#45;&#45;表格-->
    <div id="list">

    </div>


    <!--表格操作脚本-->
    <script src="list_operate.js">

    </script>

    <!--&lt;!&ndash;计时操作脚本&ndash;&gt;-->
    <!--<script src="TimeCount.js">-->

    <!--</script>-->

    <!--测试后台计时操作脚本-->
    <script>
        var w;

        function startWorker() {
            if(typeof(Worker) !== "undefined") {
                if(typeof(w) == "undefined") {
                    w = new Worker("TimeCount.js");
                }
                w.onmessage = function(event) {
                    document.getElementById("result").innerHTML = event.data;
                };
            } else {
                document.getElementById("result").innerHTML = "抱歉，你的浏览器不支持 Web Workers...";
            }
        }

        function stopWorker()
        {
            w.terminate();
            w = undefined;
        }
    </script>

</body>
</html>